﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ThuatToanDAO;
using System.Data.SqlClient;
using System.Data;

public partial class Category : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        string strQueryitemID = Request.QueryString["Categoryid"].ToString();
        string categoryid = strQueryitemID.Substring(strQueryitemID.LastIndexOf('-') + 1);
        
        //String categoryid = Request.QueryString["Categoryid"].ToString();

        CategoryDAO category = new CategoryDAO();

        DataSet dscategory = category.ExecuteSelectSingle(categoryid);
        
        // set title
        literalHeader.Text = dscategory.Tables[0].Rows[0]["Name"].ToString();
        lbl_Name.Text = dscategory.Tables[0].Rows[0]["Name"].ToString();

        
        ItemDAO item = new ItemDAO();

        List<SqlParameter> listparam = new List<SqlParameter>();

        listparam.Add(new SqlParameter("CategoryID", categoryid));
        
        DataSet ds = item.ExecuteSearchByCategory(listparam);

        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
    }
}